/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ecfdb;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author SIDALI
 */
@Entity
@Table(name = "vente", catalog = "mandataire", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Vente.findAll", query = "SELECT v FROM Vente v"),
    @NamedQuery(name = "Vente.findByIdvente", query = "SELECT v FROM Vente v WHERE v.idvente = :idvente"),
    @NamedQuery(name = "Vente.findByNombreCajot", query = "SELECT v FROM Vente v WHERE v.nombreCajot = :nombreCajot"),
    @NamedQuery(name = "Vente.findByPoid", query = "SELECT v FROM Vente v WHERE v.poid = :poid"),
    @NamedQuery(name = "Vente.findByPrixUnitaire", query = "SELECT v FROM Vente v WHERE v.prixUnitaire = :prixUnitaire"),
    @NamedQuery(name = "Vente.findByDate", query = "SELECT v FROM Vente v WHERE v.date = :date")})
public class Vente implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idvente", nullable = false)
    private Integer idvente;
    @Column(name = "nombre_cajot")
    private Integer nombreCajot;
    @Column(name = "poid")
    private Integer poid;
    @Column(name = "prix_unitaire")
    private Integer prixUnitaire;
    @Column(name = "date")
    @Temporal(TemporalType.TIMESTAMP)
    private Date date;
    @JoinColumn(name = "acheteur", referencedColumnName = "idacheteur")
    @ManyToOne
    private Acheteur acheteur;
    @JoinColumn(name = "depot", referencedColumnName = "idlegumes_depot")
    @ManyToOne
    private LegumesDepot depot;

    public Vente() {
    }

    public Vente(Integer idvente) {
        this.idvente = idvente;
    }

    public Integer getIdvente() {
        return idvente;
    }

    public void setIdvente(Integer idvente) {
        this.idvente = idvente;
    }

    public Integer getNombreCajot() {
        return nombreCajot;
    }

    public void setNombreCajot(Integer nombreCajot) {
        this.nombreCajot = nombreCajot;
    }

    public Integer getPoid() {
        return poid;
    }

    public void setPoid(Integer poid) {
        this.poid = poid;
    }

    public Integer getPrixUnitaire() {
        return prixUnitaire;
    }

    public void setPrixUnitaire(Integer prixUnitaire) {
        this.prixUnitaire = prixUnitaire;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public Acheteur getAcheteur() {
        return acheteur;
    }

    public void setAcheteur(Acheteur acheteur) {
        this.acheteur = acheteur;
    }

    public LegumesDepot getDepot() {
        return depot;
    }

    public void setDepot(LegumesDepot depot) {
        this.depot = depot;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idvente != null ? idvente.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Vente)) {
            return false;
        }
        Vente other = (Vente) object;
        if ((this.idvente == null && other.idvente != null) || (this.idvente != null && !this.idvente.equals(other.idvente))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "ecfdb.Vente[ idvente=" + idvente + " ]";
    }
    
}
